import { FC } from "react";
import { View } from "@tarojs/components";
import { AtInput, AtCard } from "taro-ui";

/**
 * ts中，谁定义，谁注解
 */

interface SearchPageProps {
  disabled?: boolean;
  note?: string;
  extra?: string;
  text?: string;
  thumb?: string;
  title?: string;
  value?: string;
  name: string;
  type?:
    | "number"
    | "password"
    | "text"
    | "phone"
    | "idcard"
    | "digit"
    | undefined;
  placeholder?: string;
  onChange(val: string): void;
  onClick?(): void;
}

const ItemView: FC<SearchPageProps> = ({
  disabled = false,
  note,
  extra,
  type = "text",
  thumb,
  title,
  value,
  name,
  placeholder,
  onChange,
  onClick,
}) => {
  return (
    // <AtCard
    //   onClick={onClick}
    //   note={note}
    //   extra={extra}
    //   title={title}
    //   thumb={thumb}
    // >
    <View style={{ margin: "10px", border: "1px solid #ccc" }}>
      <AtInput
        name={name}
        title={title}
        type={type}
        disabled={disabled}
        placeholder={placeholder}
        value={value}
        onChange={onChange}
      />
    </View>

    // </AtCard>
  );
};

export default ItemView;
